<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>商品管理</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  {include file="public/css"/}
	<style>
	.layui-form-label{width:100px}
	#ggnamediv .layui-input,#ggvaldiv .layui-input{ display:inline;height:30px}
	</style>
</head>
<body>
  <div class="layui-fluid">
    <div class="layui-row layui-col-space15">
      <div class="layui-card layui-col-md12">
				<div class="layui-card-header">
					{if !$info['id']}<i class="fa fa-plus"></i> 添加商品{else}<i class="fa fa-pencil"></i> 编辑商品{/if}
					<i class="layui-icon layui-icon-close" style="font-size:18px;font-weight:bold;cursor:pointer" onclick="closeself()"></i>
				</div>
				<div class="layui-card-body" pad15>
					{if $info['ischecked']==2}<blockquote class="layui-elem-quote" style="color:red">商品未审核通过，驳回原因：{$info.check_reason}</blockquote>{/if}
					<div class="layui-form">
						<div class="layui-tab" lay-filter="mytab">
							<ul class="layui-tab-title">
								<li class="layui-this" lay-id="1">商品信息</li>
								<li lay-id="2">商品参数</li>
								<li lay-id="3">商品详情</li>
								<li lay-id="4">分享设置</li>
							</ul>
							<div class="layui-tab-content">
								<div class="layui-tab-item layui-show">
									<input type="hidden" name="id" value="{$info['id']}"/>
									{if input('param.bid')}<input type="hidden" name="info[bid]" value="{$Request.param.bid}"/>{/if}
									<div class="layui-form-item">
										<label class="layui-form-label"><span class="redstar">*</span>商品名称：</label>
										<div class="layui-input-inline" style="width:400px">
											<input type="text" name="info[name]" lay-verify="required" lay-verType="tips" class="layui-input" value="{$info['name']}">
										</div>
									</div>
									<div class="layui-form-item">
										<label class="layui-form-label"><span class="redstar">*</span>商品主图：</label>
										<input type="hidden" name="info[pic]" id="pic" lay-verType="tips" class="layui-input" value="{$info['pic']}">
										<button style="float:left;" type="button" class="layui-btn layui-btn-primary" upload-input="pic" upload-preview="picPreview" onclick="uploader(this)">上传图片</button>
										<div class="layui-form-mid layui-word-aux" style="margin-left:10px;">建议尺寸：640×640像素</div>
										<div id="picPreview" style="float:left;padding-top:10px;padding-left:130px;clear: both;">
											<div class="layui-imgbox" style="width:100px;"><div class="layui-imgbox-img"><img src="{$info['pic']}"/></div></div>
										</div> 
									</div>
									<div class="layui-form-item">
										<label class="layui-form-label">商品图片：</label>
										<input type="hidden" name="info[pics]" value="{$info['pics']}" id="pics">
										<button style="float:left;" type="button" class="layui-btn layui-btn-primary" onclick="uploader(this,true)" upload-input="pics" upload-preview="picList" >批量上传</button>
										<div class="layui-form-mid layui-word-aux" style="margin-left:10px;">建议尺寸：640×640像素</div>
										<div id="picList" style="float:left;padding-top:10px;padding-left:130px;clear: both;">
											{if $info['pics']}{php}$pics = explode(',',$info['pics']);{/php}{foreach $pics as $pic}
											<div class="layui-imgbox">
												<a class="layui-imgbox-close" href="javascript:void(0)" onclick="$(this).parent().remove();getpicsval('pics','picList')" title="删除"><i class="layui-icon layui-icon-close-fill"></i></a>
												<span class="layui-imgbox-img"><img src="{$pic}"></span>
											</div>
											{/foreach}{/if}
										</div>
									</div>
									{if getcustom('diy_light') && $auth['diy_light']}
									<div class="layui-form-item">
										<label class="layui-form-label">配灯图片：</label>
										<input type="hidden" name="info[diypics]" value="{$info['diypics']}" id="diypics">
										<button style="float:left;" type="button" class="layui-btn layui-btn-primary" onclick="uploader(this,true)" upload-input="diypics" upload-preview="diypicList" >批量上传</button>
										<div class="layui-form-mid layui-word-aux" style="margin-left:10px;">建议尺寸：640×640像素，png格式透明背景</div>
										<div id="diypicList" style="float:left;padding-top:10px;padding-left:130px;clear: both;">
											{if $info['diypics']}{php}$diypics = explode(',',$info['diypics']);{/php}{foreach $diypics as $pic}
											<div class="layui-imgbox">
												<a class="layui-imgbox-close" href="javascript:void(0)" onclick="$(this).parent().remove();getpicsval('diypics','diypicList')" title="删除"><i class="layui-icon layui-icon-close-fill"></i></a>
												<span class="layui-imgbox-img"><img src="{$pic}"></span>
											</div>
											{/foreach}{/if}
										</div>
									</div>
									{/if}
									<div class="layui-form-item">
										<label class="layui-form-label">商品视频：</label>
										<div class="layui-input-inline" style="width:400px">
											<input type="text" name="info[video]" id="video" lay-verType="tips" class="layui-input" value="{$info['video']}">
										</div>
										<input type="hidden" name="info[video_duration]" id="video_duration" value="{$info.video_duration}">
										<button style="float:left;" type="button" class="layui-btn layui-btn-primary" upload-input="video" onclick="uploader(this)">上传视频</button>
										<div class="layui-form-mid layui-word-aux" style="margin-left:10px;">填写视频链接或上传视频，视频链接必须为mp4格式的源链接，视频大小须在50MB以内</div>
									</div>
									<!-- <div class="layui-form-item">
										<label class="layui-form-label">商品服务：</label>
										<div class="layui-input-inline" style="width:400px">
											<input type="text" name="info[fuwupoint]" class="layui-input" value="{$info['fuwupoint']}">
										</div>
										<div class="layui-form-mid layui-word-aux">多个用空格隔开,如: 7天退换 48小时发货 假一赔十</div>
									</div> -->
									<div class="layui-form-item">
										<label class="layui-form-label">商品卖点：</label>
										<div class="layui-input-inline" style="width:400px">
											<input type="text" name="info[sellpoint]" class="layui-input" value="{$info['sellpoint']}">
										</div>
										<div class="layui-form-mid layui-word-aux">在商品详情页标题下面展示卖点信息，建议60字以内</div>
									</div>
									<div class="layui-form-item">
										<label class="layui-form-label">商品分类：</label>
										<div class="layui-input-inline" style="width:400px">
											<select name="info[cid]" id="cid" xm-select="selectCid" xm-select-max="5" xm-select-search >
											<option value="">--请选择--</option>
											{foreach $clist as $cv}
												<option value="{$cv['id']}" {if in_array($cv['id'],$info['cid'])}selected{/if}>{$cv['name']}</option>
												{foreach $cv['child'] as $k=>$v}
												{if $k < count($cv['child'])-1}
												<option value="{$v['id']}" {if in_array($v['id'],$info['cid'])}selected{/if}>&nbsp;&nbsp;&nbsp;&nbsp;├ {$v['name']}</option>
												{else}
												<option value="{$v['id']}" {if in_array($v['id'],$info['cid'])}selected{/if}>&nbsp;&nbsp;&nbsp;&nbsp;└ {$v['name']}</option>
												{/if}
													{foreach $v['child'] as $k2=>$v2}
													{if $k2 < count($v['child'])-1}
													<option value="{$v2['id']}" {if in_array($v2['id'],$info['cid'])}selected{/if}>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;├ {$v2['name']}</option>
													{else}
													<option value="{$v2['id']}" {if in_array($v2['id'],$info['cid'])}selected{/if}>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└ {$v2['name']}</option>
													{/if}
													{/foreach}
												{/foreach}
											{/foreach}
											</select>
										</div>
										<div class="layui-form-mid layui-word-aux">最多可选5个分类</div>
										<!-- <div class="layui-form-mid layui-word-aux"><a href="categoryadd.php">创建分类</a></div> -->
									</div>
									{if $bid > 0}
									<div class="layui-form-item">
										<label class="layui-form-label">商家商品分类：</label>
										<div class="layui-input-inline" style="width:400px">
											<select name="info[cid2]" id="cid2" xm-select="selectCid2" xm-select-max="5" xm-select-search >
											<option value="">--请选择--</option>
											{foreach $clist2 as $cv}
												<option value="{$cv['id']}" {if in_array($cv['id'],$info['cid2'])}selected{/if}>{$cv['name']}</option>
												{foreach $cv['child'] as $k=>$v}
												{if $k < count($cv['child'])-1}
												<option value="{$v['id']}" {if in_array($v['id'],$info['cid2'])}selected{/if}>&nbsp;&nbsp;&nbsp;&nbsp;├ {$v['name']}</option>
												{else}
												<option value="{$v['id']}" {if in_array($v['id'],$info['cid2'])}selected{/if}>&nbsp;&nbsp;&nbsp;&nbsp;└ {$v['name']}</option>
												{/if}
													{foreach $v['child'] as $k2=>$v2}
													{if $k2 < count($v['child'])-1}
													<option value="{$v2['id']}" {if in_array($v2['id'],$info['cid2'])}selected{/if}>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;├ {$v2['name']}</option>
													{else}
													<option value="{$v2['id']}" {if in_array($v2['id'],$info['cid2'])}selected{/if}>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└ {$v2['name']}</option>
													{/if}
													{/foreach}
												{/foreach}
											{/foreach}
											</select>
										</div>
										<div class="layui-form-mid layui-word-aux">最多可选5个分类</div>
									</div>
									{/if}
									<div class="layui-form-item">
										<label class="layui-form-label">商品分组：</label>
										<div class="layui-input-inline" style="width:600px">
											{php} $gids = explode(',',$info['gid']);{/php}
											{foreach $glist as $g}<input type="checkbox" name="info[gid][]" value="{$g['id']}" {if in_array($g['id'],$gids)}checked{/if} title="{$g['name']}" lay-skin="primary">{/foreach}
										</div>
										<!-- <div class="layui-form-mid layui-word-aux"><a href="groupadd.php">创建分组</a></div> -->
									</div>
									<div class="layui-form-item">
										<label class="layui-form-label">商品服务：</label>
										<div class="layui-input-inline" style="width:600px">
											{php} $fwids = explode(',',$info['fwid']);{/php}
											{foreach $fuwulist as $fuwu}<input type="checkbox" name="info[fwid][]" value="{$fuwu['id']}" {if in_array($fuwu['id'],$fwids)}checked{/if} title="{$fuwu['name']}" lay-skin="primary">{/foreach}
										</div>
										<!-- <div class="layui-form-mid layui-word-aux"><a href="groupadd.php">创建分组</a></div> -->
									</div>
									<div class="layui-form-item">
										<label class="layui-form-label">商品编码：</label>
										<div class="layui-input-inline">
											<input type="text" name="info[procode]" class="layui-input" value="{$info['procode']}">
										</div>
									</div>
									{if $barcode}
									<div class="layui-form-item">
										<label class="layui-form-label">商品条码：</label>
										<div class="layui-input-inline">
											<input type="text" name="info[barcode]" class="layui-input" value="{$info['barcode']}">
										</div>
									</div>
									{/if}
									{if getcustom('to86yk')}
									<div class="layui-form-item">
										<label class="layui-form-label">对应tid：</label>
										<div class="layui-input-inline">
											<input type="text" name="info[to86yk_tid]" class="layui-input" value="{$info['to86yk_tid']}">
										</div>
									</div>
									{/if}

									{if getcustom('pay_yuanbao')}
									<div class="layui-form-item">
										<label class="layui-form-label">{:t('元宝')}价：</label>
										<div class="layui-input-inline">
											<input type="text" name="info[yuanbao]" class="layui-input" value="{$info['yuanbao']}">
										</div>
										<div class="layui-form-mid layui-word-aux">大于0时启用，设置后还需要支付{$yuanbao_money_ratio}%比例的现金</div>
									</div>
									{/if}
									{if getcustom('product_glass')}
									<div class="layui-form-item">
										<label class="layui-form-label">商品类型：</label>
										<div class="layui-input-inline" style="width: 50%">
											<input type="radio" name="info[product_type]" value="0" lay-filter="productType" class="layui-input" {if !$info || $info.product_type==0}checked{/if} title="普通商品">
											<input type="radio" name="info[product_type]" value="1" lay-filter="productType" class="layui-input" {if $info && $info.product_type==1}checked{/if} title="眼镜商品">
										</div>
									</div>
									{/if}

									<div class="layui-form-item" id="setgg">
										<label class="layui-form-label">设置规格：</label>
										<div class="layui-input-inline" style="width:auto">
											<table id="ggnamediv"  class="layui-table" style="width:600px">
												<thead>
												<tr>
													<th>规格分组</th>
													<th>规格名称</th>
													<th>操作</th>
												</tr>
												</thead>
												{php} $guigedata = json_decode($info['guigedata']);{/php}
												{if $guigedata}
												{foreach $guigedata as $k=>$gg}
												<tr>
													<td><input type="text" class="layui-input" name="ggname" value="{$gg->title}" style="width:120px"/></td>
													<td>
														{foreach $gg->items as $k2=>$ggitem}
														<div><input type="text" class="layui-input"style="width:180px" value="{$ggitem->title}" placeholder="请输入规格名称">
														{if $k2==0}
															<button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="addggname(this)" style="margin-top:-3px;"><i class="fa fa-plus" style="font-size:14px!important"></i></button>
														{else}
															<button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="$(this).parent().remove()" style="margin-top:-3px;"><i class="fa fa-remove" style="font-size:14px!important"></i></button>
														{/if}
														</div>
														{/foreach}
													</td>
													{if $k==0}
													<td><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="addggtype()">添加</button></td>
													{else}
													<td><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="$(this).parent().parent().remove()">删除</button></td>
													{/if}
												</tr>
												{/foreach}
												{else}
												<tr>
													<td><input type="text" class="layui-input" name="ggname" value="规格" style="width:120px"/></td>
													<td><div><input type="text" class="layui-input" style="width:180px" value="默认规格" placeholder="请输入规格名称"> <button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="addggname(this)" style="margin-top:-3px;"><i class="fa fa-plus" style="font-size:14px!important"></i></button></div></td>
													<td><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="addggtype()">添加</button></td>
												</tr>
												{/if}
											</table>
											<div class="layui-word-aux">提示：先点击“添加按钮”添加规格分组，如：“颜色”，“尺码”，若只有一种规格则不需要添加规格分组；<br/>然后分别点击"＋"号添加规格名称，如：“红色”，“蓝色”；“大号”，“小号”；<br/>设置完成后点击“刷新规格项目表”按钮进行编辑各个规格的价格、库存等信息</div>
											<button type="button"  class="layui-btn layui-btn-sm layui-btn-primary" onclick="refreshgg()"><i class="fa fa-refresh" style="font-size:14px!important"></i>刷新规格项目表</button>
											{if $bid==0 || $bset['product_showset']==1}<button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="lvpriceset()" id="lvpricebtn">{if $info['lvprice']==1}关闭{else}开启{/if}会员价</button>{/if}
											<input type="hidden" name="info[lvprice]" value="{$info['id']?$info['lvprice']:'0'}"/>
											<table id="ggvaldiv" class="layui-table" style="margin-top:20px;">
											</table>
											<div class="layui-form-mid layui-word-aux">注：开启会员价可设置不同会员等级显示不同价格；赠{:t('积分')}确认收货才赠送，与系统设置中的消费赠送{:t('积分')}(支付就赠送{:t('积分')})兼得</div>
											<input type="hidden" name="specs" value=""/>
										</div>
									</div>
									{if getcustom('product_givescore_time') && $bid==0}
									<div class="layui-form-item">
										<label class="layui-form-label">积分赠送时间：</label>
										<div class="layui-input-inline" style="width:500px">
											<input type="radio" name="info[givescore_time]" value="0" title="确认收货后" {if !$info['id'] || $info['givescore_time']==0}checked{/if} lay-filter=""/>
											<input type="radio" name="info[givescore_time]" value="1" title="付款后" {if $info['id'] && $info['givescore_time']==1}checked{/if} lay-filter=""/>
										</div>
									</div>
									{/if}

									<div class="layui-form-item">
										<label class="layui-form-label">价格模式：</label>
										<div class="layui-input-inline" style="width:260px;overflow: hidden;">
											<input type="radio" name="info[price_type]" value="0" title="默认" {if !$info['id'] || $info['price_type']==0}checked{/if} lay-filter=""/>
											<input type="radio" name="info[price_type]" value="1" title="询价" {if $info['id'] && $info['price_type']==1}checked{/if} lay-filter=""/>
											{if getcustom('shop_other_infor')}
											<input type="text" name="info[xunjia_text]" id="xunjia_text" lay-verType="tips" class="layui-input" style="width: 100px;float: right;" value="{$info['xunjia_text']?$info['xunjia_text']:'联系TA'}">
											{/if}
										</div>
										<div class="layui-form-mid layui-word-aux">默认：展示售价，详情页展示购买和加入购物车，可下单；询价：不设置售价时不展示，详情页展示联系按钮（点击展示系统设置的商家名称和服务电话），不可下单。</div>
									</div>
									<div class="layui-form-item">
										<label class="layui-form-label">配送模板：</label>
										<div class="layui-input-inline" style="width:500px">
											<input type="radio" name="info[freighttype]" value="1" title="全部模板" {if !$info['id'] || $info['freighttype']==1}checked{/if} lay-filter="freighttypeset"/>
											<input type="radio" name="info[freighttype]" value="0" title="选择模板" {if $info['id'] && $info['freighttype']==0}checked{/if} lay-filter="freighttypeset"/>
											<input type="radio" name="info[freighttype]" value="3" title="自动发货" {if $info['id'] && $info['freighttype']==3}checked{/if} lay-filter="freighttypeset"/>
											<input type="radio" name="info[freighttype]" value="4" title="在线卡密" {if $info['id'] && $info['freighttype']==4}checked{/if} lay-filter="freighttypeset"/>
										</div>
										
										<div id="freighttype3" style="{if $info['freighttype']!=3}display:none{/if}">
											<div class="layui-form-item">
												<label class="layui-form-label"></label>
												<div class="layui-input-inline" style="width:500px">
													<textarea type="text" name="info[freightcontent]" placeholder="请输入发货信息" class="layui-textarea">{$info.freightcontent}</textarea>
												</div>
											</div>
										</div>
										<div id="freighttype4" style="{if $info['freighttype']!=4}display:none{/if}">
											<div class="layui-form-item">
												<label class="layui-form-label"></label>
												<div class="layui-form-mid">请保存商品信息后在商品列表中上传卡密信息；用户购买几件将发送几个卡密信息</div>
											</div>
										</div>

										<div id="setfreight" style="clear:both;{if !$info['id'] || $info['freighttype']!=0}display:none{/if}">
											<label class="layui-form-label"></label>
											<div class="layui-input-inline" style="width:auto">
												<table id="setfreightdiv"  class="layui-table" style="width:500px">
													<thead>
													<tr>
														<th>模板ID</th>
														<th>模板名称</th>
														<th>操作</th>
													</tr>
													</thead>
													
													{if $freightdata}
													{foreach $freightdata as $k=>$ff}
													<tr class="freightlisttr"><td>{$ff.id}</td><td>{$ff.name}</td><td><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="delfreight(this,{$ff.id})">删除</button></td></tr>
													{/foreach}
													{/if}
													<tr id="freightaddtr">
														<td colspan="3"><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="showChooseFreight()">添加</button></td>
													</tr>
												</table>
												<input type="hidden" name="info[freightdata]" value="{$info.freightdata}"/>
											</div>
										</div>
									</div>
									<script>
									var chooseFreightLayer;
									function showChooseFreight(){ //
										chooseFreightLayer = layer.open({type:2,title:'选择配送模板',content:"{:url('Freight/choosefreight')}&bid={$info.bid}",area:['1000px','600px'],shadeClose:true});
									}
									function chooseFreight(fid,fname){
										layer.close(chooseFreightLayer);
										var freightlistids = [];
										var isadd = 0;
										$('.freightlisttr').each(function(){
											var thisfid = $(this).find('td:eq(0)').html();
											if(thisfid == fid){
												isadd = 1
												dialog('该配送模板已添加过了');
											}
											freightlistids.push(thisfid)
										})
										if(isadd == 0){
											freightlistids.push(fid)
											$("input[name='info[freightdata]']").val(freightlistids.join(','));
											$('#freightaddtr').before('<tr class="freightlisttr"><td>'+fid+'</td><td>'+fname+'</td><td><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="delfreight(this,'+fid+')">删除</button></td></tr>');
										}
										console.log(freightlistids)
									}
									function delfreight(obj,fid){
										$(obj).parent().parent().remove();
										var freightlistids = [];
										$('.freightlisttr').each(function(){
											freightlistids.push($(this).find('td:eq(0)').html())
										})
										$("input[name='info[freightdata]']").val(freightlistids.join(','));
									}
									</script>
									{if $bid==0 || $bset['commission_canset']==1}
									<div class="layui-form-item">
										<label class="layui-form-label">分销设置：</label>
										<div class="layui-input-block" style="width:900px">
											<input type="radio" name="info[commissionset]" value="0" {if !$info['id'] || $info['commissionset']==0}checked{/if} title="按照{:t('会员')}等级" lay-filter="commissionset">
											<input type="radio" name="info[commissionset]" value="1" {if $info['commissionset']==1}checked{/if} title="单独设置提成比例" lay-filter="commissionset">
											<input type="radio" name="info[commissionset]" value="2" {if $info['commissionset']==2}checked{/if} title="单独设置提成金额" lay-filter="commissionset">
											{if $bid==0}
											<input type="radio" name="info[commissionset]" value="3" {if $info['commissionset']==3}checked{/if} title="分销送{:t('积分')}" lay-filter="commissionset">
											{/if}
											<!-- <span {if $info['lvprice']==0}style="display:none"{/if} id="commissionset4input">
											<input type="radio" name="info[commissionset]" value="4" {if $info['commissionset']==4}checked{/if} title="按差价拿{:t('佣金')}" lay-filter="commissionset">
											</span> -->
											<input type="radio" name="info[commissionset]" value="-1" {if $info['commissionset']==-1}checked{/if} title="不参与分销" lay-filter="commissionset">
										</div>
										<div class="layui-form-mid layui-word-aux">按照{:t('会员')}等级：按照{:t('会员')}等级中设置的提成比例进行提成分配，提成=对应{:t('会员')}等级的提成比例×{$jiesuantypeDesc}×购买数量<br>
										单独设置提成比例：按照单独设置的提成比例进行提成分配，提成=设置的百分比×{$jiesuantypeDesc}×购买数量<br>
										单独设置提成金额：按照单独设置的提成金额进行提成分配，提成=提成金额×购买数量<br>
										分销送{:t('积分')}：分销提成不给{:t('佣金')}而是给{:t('积分')}，得到的积分=提成{:t('积分')}×购买数量<br>
											* 当商家开启独立收款并且开启商家返款扣除分销佣金时，提成金额比例+平台抽成金额比例不能超过30%（微信支付分账限制）
										<!-- <span id="commissionset4tips" {if $info['lvprice']==0}style="display:none"{/if}>按差价拿{:t('佣金')}：当开启会员价时，不同的会员等级存在价格差，如果上级与下级之间存在价格差，则此价格差作为{:t('佣金')}返给上级</span> -->
										</div>
									</div>
									{php}
									$commissiondata1 = json_decode($info['commissiondata1'],true);
									if(!$commissiondata1) $commissiondata1 = [];
									$commissiondata2 = json_decode($info['commissiondata2'],true);
									if(!$commissiondata2) $commissiondata2 = [];
									$commissiondata3 = json_decode($info['commissiondata3'],true);
									if(!$commissiondata3) $commissiondata3 = [];
									{/php}
									<div id="commissionset1" {if $info['commissionset']!=1}style="display:none"{/if}>
										{if !$aglevellist}
										<div class="layui-form-item">
											<label class="layui-form-label">提成比例：</label>
											<div class="layui-form-mid" style="color:red">未设置具有分销权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置分销权限</div>
										</div>
										{else}
										{foreach $aglevellist as $level}
										<div class="layui-form-item">
											<label class="layui-form-label">{$level.name}：</label>
											<div class="layui-form-mid" style="margin-right:0;background:#e6e6e6;padding: 9px 9px !important"> 一级(%) </div>
											<div class="layui-input-inline" style="width: 100px;">
												<input style="border-radius:0 2px 2px 0" type="text" name="commissiondata1[{$level.id}][commission1]" class="layui-input" value="{$commissiondata1[$level['id']]['commission1']}">
											</div>
											{if $level['can_agent']>1}
											<div class="layui-form-mid" style="margin-right:0;background:#e6e6e6;padding: 9px 9px !important">二级(%)</div>
											<div class="layui-input-inline" style="width: 100px;">
												<input style="border-radius:0 2px 2px 0" type="text" name="commissiondata1[{$level.id}][commission2]" class="layui-input" value="{$commissiondata1[$level['id']]['commission2']}">
											</div>
											{/if}
											{if $level['can_agent']>2}
											<div class="layui-form-mid" style="margin-right:0;background:#e6e6e6;padding: 9px 9px !important">三级(%)</div>
											<div class="layui-input-inline" style="width: 100px;">
												<input style="border-radius:0 2px 2px 0" type="text" name="commissiondata1[{$level.id}][commission3]" class="layui-input" value="{$commissiondata1[$level['id']]['commission3']}">
											</div>
											{/if}
										</div>
										{/foreach}
										{/if}
									</div>
									<div id="commissionset2" {if $info['commissionset']!=2}style="display:none"{/if}>
										{if !$aglevellist}
										<div class="layui-form-item">
											<label class="layui-form-label">提成金额：</label>
											<div class="layui-form-mid" style="color:red">未设置具有分销权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置分销权限</div>
										</div>
										{else}
										{foreach $aglevellist as $level}
										<div class="layui-form-item">
											<label class="layui-form-label">{$level.name}：</label>
											<div class="layui-form-mid" style="margin-right:0;background:#e6e6e6;padding: 9px 9px !important"> 一级(元) </div>
											<div class="layui-input-inline" style="width: 100px;">
												<input style="border-radius:0 2px 2px 0" type="text" name="commissiondata2[{$level.id}][commission1]" class="layui-input" value="{$commissiondata2[$level['id']]['commission1']}">
											</div>
											{if $level['can_agent']>1}
											<div class="layui-form-mid" style="margin-right:0;background:#e6e6e6;padding: 9px 9px !important">二级(元)</div>
											<div class="layui-input-inline" style="width: 100px;">
												<input style="border-radius:0 2px 2px 0" type="text" name="commissiondata2[{$level.id}][commission2]" class="layui-input" value="{$commissiondata2[$level['id']]['commission2']}">
											</div>
											{/if}
											{if $level['can_agent']>2}
											<div class="layui-form-mid" style="margin-right:0;background:#e6e6e6;padding: 9px 9px !important">三级(元)</div>
											<div class="layui-input-inline" style="width: 100px;">
												<input style="border-radius:0 2px 2px 0" type="text" name="commissiondata2[{$level.id}][commission3]" class="layui-input" value="{$commissiondata2[$level['id']]['commission3']}">
											</div>
											{/if}
										</div>
										{/foreach}
										{/if}
										{if getcustom('fengdanjiangli')}
										<div class="layui-form-item">
											<label class="layui-form-label">逢单奖励：</label>
											<div class="layui-input-inline" style="width:210px;">
												<input type="text" name="info[fengdanjiangli]" class="layui-input" value="{$info.fengdanjiangli}">
											</div>
											<div class="layui-form-mid layui-word-aux">即尾数为第几单给奖励,用英文逗号","分割,如:3,6,9</div>
										</div>
										{/if}
									</div>
									<div id="commissionset3" {if $info['commissionset']!=3}style="display:none"{/if}>
										{if !$aglevellist}
										<div class="layui-form-item">
											<label class="layui-form-label">提成{:t('积分')}：</label>
											<div class="layui-form-mid" style="color:red">未设置具有分销权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置分销权限</div>
										</div>
										{else}
										{foreach $aglevellist as $level}
										<div class="layui-form-item">
											<label class="layui-form-label">{$level.name}：</label>
											<div class="layui-form-mid" style="margin-right:0;background:#e6e6e6;padding: 9px 9px !important"> 一级({:t('积分')}) </div>
											<div class="layui-input-inline" style="width: 100px;">
												<input style="border-radius:0 2px 2px 0" type="text" name="commissiondata3[{$level.id}][commission1]" class="layui-input" value="{$commissiondata3[$level['id']]['commission1']}">
											</div>
											{if $level['can_agent']>1}
											<div class="layui-form-mid" style="margin-right:0;background:#e6e6e6;padding: 9px 9px !important">二级({:t('积分')})</div>
											<div class="layui-input-inline" style="width: 100px;">
												<input style="border-radius:0 2px 2px 0" type="text" name="commissiondata3[{$level.id}][commission2]" class="layui-input" value="{$commissiondata3[$level['id']]['commission2']}">
											</div>
											{/if}
											{if $level['can_agent']>2}
											<div class="layui-form-mid" style="margin-right:0;background:#e6e6e6;padding: 9px 9px !important">三级({:t('积分')})</div>
											<div class="layui-input-inline" style="width: 100px;">
												<input style="border-radius:0 2px 2px 0" type="text" name="commissiondata3[{$level.id}][commission3]" class="layui-input" value="{$commissiondata3[$level['id']]['commission3']}">
											</div>
											{/if}
										</div>
										{/foreach}
										{/if}
									</div>


									{if getcustom('commission_parent_pj')}
									<div class="layui-form-item">
										<label class="layui-form-label">平级奖：</label>
										<div class="layui-input-block" style="width:700px">
											<input type="radio" name="info[commissionpingjiset]" value="0" {if !$info['id'] || $info['commissionpingjiset']==0}checked{/if} title="按照{:t('会员')}等级" lay-filter="commissionpingjiset">
											<input type="radio" name="info[commissionpingjiset]" value="1" {if $info['commissionpingjiset']==1}checked{/if} title="单独设置奖励比例" lay-filter="commissionpingjiset">
											<input type="radio" name="info[commissionpingjiset]" value="2" {if $info['commissionpingjiset']==2}checked{/if} title="单独设置奖励金额" lay-filter="commissionpingjiset">
											<input type="radio" name="info[commissionpingjiset]" value="-1" {if $info['commissionpingjiset']==-1}checked{/if} title="不参与平级奖" lay-filter="commissionpingjiset">
										</div>
										<div class="layui-form-mid layui-word-aux">下级等级和自己等级相同时拿下级分销金额的奖励百分比或奖励金额，只给最近的上级</div>
									</div>
									{php}
									$commissionpingjidata1 = json_decode($info['commissionpingjidata1'],true);
									if(!$commissionpingjidata1) $commissionpingjidata1 = [];
									$commissionpingjidata2 = json_decode($info['commissionpingjidata2'],true);
									if(!$commissionpingjidata2) $commissionpingjidata2  = [];
									{/php}
									<div id="commissionpingjiset1" {if $info['commissionpingjiset']!=1}style="display:none"{/if}>
										<div class="layui-form-item">
											<label class="layui-form-label">奖励比例：</label>
											{if !$aglevellist}<div class="layui-form-mid" style="color:red">未设置具有分销权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置分销权限</div>{/if}
											{foreach $aglevellist as $level}
											<div class="layui-form-mid" style="margin-right:0;background:#e6e6e6;padding: 9px 9px !important"> {$level.name}(%) </div>
											<div class="layui-input-inline" style="width: 100px;">
												<input style="border-radius:0 2px 2px 0" type="text" name="commissionpingjidata1[{$level.id}][commission]" class="layui-input" value="{$commissionpingjidata1[$level['id']]['commission']}">
											</div>
											{/foreach}
										</div>
									</div>
									<div id="commissionpingjiset2" {if $info['commissionpingjiset']!=2}style="display:none"{/if}>
										<div class="layui-form-item">
											<label class="layui-form-label">奖励金额：</label>
											{if !$aglevellist}<div class="layui-form-mid" style="color:red">未设置具有分销权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置</div>{/if}
											{foreach $aglevellist as $level}
											<div class="layui-form-mid" style="margin-right:0;background:#e6e6e6;padding: 9px 9px !important"> {$level.name}(元) </div>
											<div class="layui-input-inline" style="width: 100px;">
												<input style="border-radius:0 2px 2px 0" type="text" name="commissionpingjidata2[{$level.id}][commission]" class="layui-input" value="{$commissionpingjidata2[$level['id']]['commission']}">
											</div>
											{/foreach}
										</div>
									</div>
									{/if}

									<div class="layui-form-item" {if $info['lvprice']==0}style="display:none"{/if} id="commissionset4input">
										<label class="layui-form-label">极差分销：</label>
										<div class="layui-input-block" style="width:800px">
											<input type="radio" name="info[commissionset4]" value="0" title="关闭" {if !$info['id'] || $info['commissionset4']==0}checked{/if}>
											<input type="radio" name="info[commissionset4]" value="1" title="开启" {if $info['commissionset4']==1}checked{/if}>
										</div>
										<div class="layui-form-mid layui-word-aux">开启时，如果设置了不同的会员等级的价格不同，如果上级与下级之间存在价格差，则此价格差作为{:t('佣金')}返给上级</div>
									</div>
									{/if}

									{if $bid==0 && ($auth_data=='all' || in_array('gdfenhong',$auth_data) || in_array('teamfenhong',$auth_data) || in_array('areafenhong',$auth_data))}
									<div class="layui-form-item">
										<label class="layui-form-label">分红设置：</label>
										<div class="layui-input-block" style="width:800px">
											<input type="radio" name="info[fenhongset]" value="1" {if !$info['id'] || $info['fenhongset']==1}checked{/if} title="参与" lay-filter="fenhongset">
											<input type="radio" name="info[fenhongset]" value="0" {if $info['id'] && $info['fenhongset']==0}checked{/if} title="不参与" lay-filter="fenhongset">
										</div>
									</div>
									<div id="fenhongset" {if $info['id'] && $info['fenhongset']==0}style="display:none"{/if}>
										{if $auth_data=='all' || in_array('teamfenhong',$auth_data)}
										<div class="layui-form-item">
											<label class="layui-form-label">团队分红：</label>
											<div class="layui-input-block" style="width:700px">
												<input type="radio" name="info[teamfenhongset]" value="0" {if !$info['id'] || $info['teamfenhongset']==0}checked{/if} title="按照{:t('会员')}等级" lay-filter="teamfenhongset">
												<input type="radio" name="info[teamfenhongset]" value="1" {if $info['teamfenhongset']==1}checked{/if} title="单独设置分红比例" lay-filter="teamfenhongset">
												<input type="radio" name="info[teamfenhongset]" value="2" {if $info['teamfenhongset']==2}checked{/if} title="单独设置分红金额" lay-filter="teamfenhongset">
												<input type="radio" name="info[teamfenhongset]" value="-1" {if $info['teamfenhongset']==-1}checked{/if} title="不参与分红" lay-filter="teamfenhongset">
											</div>
											<div class="layui-form-mid layui-word-aux">开启后可以拿到团队中所有{:t('会员')}的所有商城订单的分红金额或比例，请先在[{:t('会员')}]-[等级及分销]设置分红级数</div>
										</div>
										{php}
										$teamfenhongdata1 = json_decode($info['teamfenhongdata1'],true);
										if(!$teamfenhongdata1) $teamfenhongdata1 = [];
										$teamfenhongdata2 = json_decode($info['teamfenhongdata2'],true);
										if(!$teamfenhongdata2) $teamfenhongdata2  = [];
										{/php}
										<div id="teamfenhongset1" {if $info['teamfenhongset']!=1}style="display:none"{/if}>
											<div class="layui-form-item">
												<label class="layui-form-label">分红比例：</label>
												{if !$teamlevellist}<div class="layui-form-mid" style="color:red">未设置具有团队分红权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置</div>{/if}
												{foreach $teamlevellist as $level}
												<div class="layui-form-mid" style="margin-right:0;background:#e6e6e6;padding: 9px 9px !important"> {$level.name}(%) </div>
												<div class="layui-input-inline" style="width: 100px;">
													<input style="border-radius:0 2px 2px 0" type="text" name="teamfenhongdata1[{$level.id}][commission]" class="layui-input" value="{$teamfenhongdata1[$level['id']]['commission']}">
												</div>
												{/foreach}
											</div>
										</div>
										<div id="teamfenhongset2" {if $info['teamfenhongset']!=2}style="display:none"{/if}>
											<div class="layui-form-item">
												<label class="layui-form-label">分红金额：</label>
												{if !$teamlevellist}<div class="layui-form-mid" style="color:red">未设置具有团队分红权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置</div>{/if}
												{foreach $teamlevellist as $level}
												<div class="layui-form-mid" style="margin-right:0;background:#e6e6e6;padding: 9px 9px !important"> {$level.name}(元) </div>
												<div class="layui-input-inline" style="width: 100px;">
													<input style="border-radius:0 2px 2px 0" type="text" name="teamfenhongdata2[{$level.id}][commission]" class="layui-input" value="{$teamfenhongdata2[$level['id']]['commission']}">
												</div>
												{/foreach}
											</div>
										</div>
										{/if}
										{if getcustom('teamfenhong_pingji') && ($auth_data == 'all' || in_array('teamfenhong_pingji',$auth_data))}
										<div class="layui-form-item">
											<label class="layui-form-label">团队分红平级奖：</label>
											<div class="layui-input-block" style="width:700px">
												<input type="radio" name="info[teamfenhongpjset]" value="0" {if !$info['id'] || $info['teamfenhongpjset']==0}checked{/if} title="按照{:t('会员')}等级" lay-filter="teamfenhongpjset">
												<input type="radio" name="info[teamfenhongpjset]" value="1" {if $info['teamfenhongpjset']==1}checked{/if} title="单独设置奖励比例" lay-filter="teamfenhongpjset">
												<input type="radio" name="info[teamfenhongpjset]" value="2" {if $info['teamfenhongpjset']==2}checked{/if} title="单独设置奖励金额" lay-filter="teamfenhongpjset">
												<input type="radio" name="info[teamfenhongpjset]" value="-1" {if $info['teamfenhongpjset']==-1}checked{/if} title="不参与奖励" lay-filter="teamfenhongpjset">
											</div>
											<div class="layui-form-mid layui-word-aux">请先在[{:t('会员')}]-[等级及分销]设置分红级数</div>
										</div>
										{php}
										$teamfenhongpjdata1 = json_decode($info['teamfenhongpjdata1'],true);
										if(!$teamfenhongpjdata1) $teamfenhongpjdata1 = [];
										$teamfenhongpjdata2 = json_decode($info['teamfenhongpjdata2'],true);
										if(!$teamfenhongpjdata2) $teamfenhongpjdata2  = [];
										{/php}
										<div id="teamfenhongpjset1" {if $info['teamfenhongpjset']!=1}style="display:none"{/if}>
											<div class="layui-form-item">
												<label class="layui-form-label">奖励比例：</label>
												{if !$teampjlevellist}<div class="layui-form-mid" style="color:red">未设置具有团队分红平级奖权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置</div>{/if}
												{foreach $teampjlevellist as $level}
												<div class="layui-form-mid" style="margin-right:0;background:#e6e6e6;padding: 9px 9px !important"> {$level.name}(%) </div>
												<div class="layui-input-inline" style="width: 100px;">
													<input style="border-radius:0 2px 2px 0" type="text" name="teamfenhongpjdata1[{$level.id}][commission]" class="layui-input" value="{$teamfenhongpjdata1[$level['id']]['commission']}">
												</div>
												{/foreach}
											</div>
										</div>
										<div id="teamfenhongpjset2" {if $info['teamfenhongpjset']!=2}style="display:none"{/if}>
											<div class="layui-form-item">
												<label class="layui-form-label">奖励金额：</label>
												{if !$teampjlevellist}<div class="layui-form-mid" style="color:red">未设置具有团队分红权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置</div>{/if}
												{foreach $teampjlevellist as $level}
												<div class="layui-form-mid" style="margin-right:0;background:#e6e6e6;padding: 9px 9px !important"> {$level.name}(元) </div>
												<div class="layui-input-inline" style="width: 100px;">
													<input style="border-radius:0 2px 2px 0" type="text" name="teamfenhongpjdata2[{$level.id}][commission]" class="layui-input" value="{$teamfenhongpjdata2[$level['id']]['commission']}">
												</div>
												{/foreach}
											</div>
										</div>
										{/if}
										{if $auth_data=='all' || in_array('gdfenhong',$auth_data)}
										<div class="layui-form-item">
											<label class="layui-form-label">股东分红：</label>
											<div class="layui-input-block" style="width:700px">
												<input type="radio" name="info[gdfenhongset]" value="0" {if !$info['id'] || $info['gdfenhongset']==0}checked{/if} title="按照会员等级" lay-filter="gdfenhongset">
												<input type="radio" name="info[gdfenhongset]" value="1" {if $info['gdfenhongset']==1}checked{/if} title="单独设置分红比例" lay-filter="gdfenhongset">
												<input type="radio" name="info[gdfenhongset]" value="2" {if $info['gdfenhongset']==2}checked{/if} title="单独设置分红金额" lay-filter="gdfenhongset">
												<input type="radio" name="info[gdfenhongset]" value="-1" {if $info['gdfenhongset']==-1}checked{/if} title="不参与分红" lay-filter="gdfenhongset">
											</div>
											<div class="layui-form-mid layui-word-aux">用于股东分红或合伙人分红，开启后相应等级的所有{:t('会员')}平均分摊设置的分红金额或比例</div>
										</div>
										{php}
										$gdfenhongdata1 = json_decode($info['gdfenhongdata1'],true);
										if(!$gdfenhongdata1) $gdfenhongdata1 = [];
										$gdfenhongdata2 = json_decode($info['gdfenhongdata2'],true);
										if(!$gdfenhongdata2) $gdfenhongdata2  = [];
										{/php}
										<div id="gdfenhongset1" {if $info['gdfenhongset']!=1}style="display:none"{/if}>
											<div class="layui-form-item">
												<label class="layui-form-label">分红比例：</label>
												{if !$gdlevellist}<div class="layui-form-mid" style="color:red">未设置具有股东分红权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置</div>{/if}
												{foreach $gdlevellist as $level}
												<div class="layui-form-mid" style="margin-right:0;background:#e6e6e6;padding: 9px 9px !important"> {$level.name}(%) </div>
												<div class="layui-input-inline" style="width: 100px;">
													<input style="border-radius:0 2px 2px 0" type="text" name="gdfenhongdata1[{$level.id}][commission]" class="layui-input" value="{$gdfenhongdata1[$level['id']]['commission']}">
												</div>
												{/foreach}
											</div>
										</div>
										<div id="gdfenhongset2" {if $info['gdfenhongset']!=2}style="display:none"{/if}>
											<div class="layui-form-item">
												<label class="layui-form-label">分红金额：</label>
												{if !$gdlevellist}<div class="layui-form-mid" style="color:red">未设置具有股东分红权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置</div>{/if}
												{foreach $gdlevellist as $level}
												<div class="layui-form-mid" style="margin-right:0;background:#e6e6e6;padding: 9px 9px !important"> {$level.name}(元) </div>
												<div class="layui-input-inline" style="width: 100px;">
													<input style="border-radius:0 2px 2px 0" type="text" name="gdfenhongdata2[{$level.id}][commission]" class="layui-input" value="{$gdfenhongdata2[$level['id']]['commission']}">
												</div>
												{/foreach}
											</div>
										</div>
										{/if}
										{if $auth_data=='all' || in_array('areafenhong',$auth_data)}
										<div class="layui-form-item">
											<label class="layui-form-label">区域代理分红：</label>
											<div class="layui-input-block" style="width:700px">
												<input type="radio" name="info[areafenhongset]" value="0" {if !$info['id'] || $info['areafenhongset']==0}checked{/if} title="按照会员等级" lay-filter="areafenhongset">
												<input type="radio" name="info[areafenhongset]" value="1" {if $info['areafenhongset']==1}checked{/if} title="单独设置分红比例" lay-filter="areafenhongset">
												<input type="radio" name="info[areafenhongset]" value="2" {if $info['areafenhongset']==2}checked{/if} title="单独设置分红金额" lay-filter="areafenhongset">
												<input type="radio" name="info[areafenhongset]" value="-1" {if $info['areafenhongset']==-1}checked{/if} title="不参与分红" lay-filter="areafenhongset">
											</div>
											<div class="layui-form-mid layui-word-aux">设置分红比例或分红金额后该等级的同一个代理区域的人平均分摊所有商城内该区域的订单的分红提成比例或分红金额</div>
										</div>
										{php}
										$areafenhongdata1 = json_decode($info['areafenhongdata1'],true);
										if(!$areafenhongdata1) $areafenhongdata1 = [];
										$areafenhongdata2 = json_decode($info['areafenhongdata2'],true);
										if(!$areafenhongdata2) $areafenhongdata2  = [];
										{/php}
										<div id="areafenhongset1" {if $info['areafenhongset']!=1}style="display:none"{/if}>
											<div class="layui-form-item">
												<label class="layui-form-label">分红比例：</label>
												{if !$areafhlevellist}<div class="layui-form-mid" style="color:red">未设置具有区域代理分红权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置</div>{/if}
												{foreach $areafhlevellist as $level}
												<div class="layui-form-mid" style="margin-right:0;background:#e6e6e6;padding: 9px 9px !important"> {$level.name}(%) </div>
												<div class="layui-input-inline" style="width: 100px;">
													<input style="border-radius:0 2px 2px 0" type="text" name="areafenhongdata1[{$level.id}][commission]" class="layui-input" value="{$areafenhongdata1[$level['id']]['commission']}">
												</div>
												{/foreach}
											</div>
										</div>
										<div id="areafenhongset2" {if $info['areafenhongset']!=2}style="display:none"{/if}>
											<div class="layui-form-item">
												<label class="layui-form-label">分红金额：</label>
												{if !$areafhlevellist}<div class="layui-form-mid" style="color:red">未设置具有区域代理分红权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置</div>{/if}
												{foreach $areafhlevellist as $level}
												<div class="layui-form-mid" style="margin-right:0;background:#e6e6e6;padding: 9px 9px !important"> {$level.name}(元) </div>
												<div class="layui-input-inline" style="width: 100px;">
													<input style="border-radius:0 2px 2px 0" type="text" name="areafenhongdata2[{$level.id}][commission]" class="layui-input" value="{$areafenhongdata2[$level['id']]['commission']}">
												</div>
												{/foreach}
											</div>
										</div>
										{/if}
									</div>
									{/if}

  									{if getcustom('product_commission_mid')}
									  <div class="layui-form-item">
										  <label class="layui-form-label">指定{:t('会员')}佣金：</label>
										  <div class="layui-input-block" style="width:800px">
											  <table class="layui-table product_commission_mid" style="width:540px" id="product_commission_mid">
												  <thead>
												  <tr>
													  <th>{:t('会员')}ID</th>
													  <th>名称</th>
													  <th>提成比例(%)</th>
													  <th>提成金额</th>
													  <th>操作</th>
												  </tr>
												  </thead>
												  {if $info['commission_mid']}
												  {foreach $info['commission_mid'] as $k=>$item}
												  <tr class="choose-tr-list">
													  <td><input type="text" name="commission_mid[{$item.ks}][mid]" value="{$item.mid}" class="layui-input" style="width:70px"/></td>
													  <td><input type="text" name="commission_mid[{$item.ks}][name]" value="{$item.name}" class="layui-input" style="width:120px"/></td>
													  <td><input type="text" name="commission_mid[{$item.ks}][percent]" value="{$item.percent}" class="layui-input" style="width:70px"/></td>
													  <td><input type="text" name="commission_mid[{$item.ks}][money]" value="{$item.money}" class="layui-input" style="width:70px"/></td>
													  <td><input type="hidden" name="commission_mid[{$item.ks}][ks]" value="{$item.ks}"><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="delChooseTrUp(this)">删除</button></td>
												  </tr>
												  {/foreach}
												  {/if}
												  <tr class="choose-tr-add">
													  <td colspan="5" align="center"><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="addChooseTrUp()">添加</button></td>
												  </tr>
											  </table>
											  <script>
												  let ks_c = {:count($info['commission_mid'])};
												  function addChooseTrUp(){
													  var chooseClassName = '.product_commission_mid';
													  var tr = '<tr class="choose-tr-list">' +
															  '<td><input type="text" name="commission_mid['+ks_c+'][mid]" value="" class="layui-input" style="width:70px"/></td>'+
															  '<td><input type="text" name="commission_mid['+ks_c+'][name]" value="" class="layui-input" style="width:120px"/></td>'+
															  '<td><input type="text" name="commission_mid['+ks_c+'][percent]" value="" class="layui-input" style="width:70px"/></td>'+
															  '<td><input type="text" name="commission_mid['+ks_c+'][money]" value="" class="layui-input" style="width:70px"/></td>'+
															  '<td><input type="hidden" name="commission_mid['+ks_c+'][ks]" value="'+ks_c+'"><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="delChooseTrUp(this)">删除</button></td>' +
															  '</tr>';
													  ks_c +=1;
													  $(chooseClassName).find('.choose-tr-add').before(tr);
												  }
												  function delChooseTrUp(obj){
													  $(obj).closest('.choose-tr-list').remove();
												  }
											  </script>
										  </div>
									  </div>
									{/if}

									{if $bid==0}
									<div class="layui-form-item">
										<label class="layui-form-label">{:t('积分')}抵扣：</label>
										<div class="layui-input-block" style="width:800px">
											<input type="radio" name="info[scoredkmaxset]" value="0" {if !$info['id'] || $info['scoredkmaxset']==0}checked{/if} title="按照系统设置抵扣" lay-filter="scoredkmaxset">
											<input type="radio" name="info[scoredkmaxset]" value="1" {if $info['scoredkmaxset']==1}checked{/if} title="单独设置抵扣比例" lay-filter="scoredkmaxset">
											<input type="radio" name="info[scoredkmaxset]" value="2" {if $info['scoredkmaxset']==2}checked{/if} title="单独设置抵扣金额" lay-filter="scoredkmaxset">
											<input type="radio" name="info[scoredkmaxset]" value="-1" {if $info['scoredkmaxset']==-1}checked{/if} title="不可用{:t('积分')}抵扣" lay-filter="scoredkmaxset">
										</div>
									</div>
									<div id="scoredkmaxset1" {if $info['scoredkmaxset']!=1 && $info['scoredkmaxset']!=2}style="display:none"{/if}>
										<div class="layui-form-item">
											<label class="layui-form-label"></label>
											<div class="layui-form-mid" style="margin-right:0;background:#e6e6e6;padding: 9px 9px !important">最多抵扣(<span id="scoredkmaxunit">{$info['scoredkmaxset']==1?'%':'元'}</span>) </div>
											<div class="layui-input-inline">
												<input type="text" name="info[scoredkmaxval]" value="{$info.scoredkmaxval}" class="layui-input">
											</div>
										</div>
									</div>
									{if $info['bid']>0}
									<div class="layui-form-item">
										<label class="layui-form-label">抽成费率：</label>
										<div class="layui-input-inline" style="width:200px">
											<input type="text" name="info[feepercent]" class="layui-input" value="{$info.feepercent}">
										</div>
										<div class="layui-form-mid layui-word-aux" style="margin-left:10px;">%，平台收取的佣金比例，留空使用商户统一费率，如设置10%，平台抽佣10%，商家得90%；设置0则不抽成</div>
									</div>
									{/if}
									{else}
									<div class="layui-form-item">
										<label class="layui-form-label">抽成费率：</label>
										<div class="layui-input-inline" style="width:200px">
											<input type="text" name="" disabled readonly class="layui-input layui-disabled" value="{$info.feepercent}">
										</div>
										<div class="layui-form-mid layui-word-aux" style="margin-left:10px;">%，平台收取的佣金比例，留空使用商户统一费率(商家不可修改)</div>
									</div>
									{/if}
									<div class="layui-form-item">
										<label class="layui-form-label">销量：</label>
										<div class="layui-input-inline">
											<input type="text" name="info[sales]" value="{$info['id']?$info['sales']:'0'}" class="layui-input">
											<input type="hidden" name="info[oldsales]" value="{$info['id']?$info['sales']:'0'}" class="layui-input">
										</div>
									</div>
									<div class="layui-form-item">
										<label class="layui-form-label">起售数量：</label>
										<div class="layui-input-inline">
											<input type="number" name="info[limit_start]" value="{$info['id']?$info['limit_start']:'0'}" class="layui-input">
										</div>
										<div class="layui-form-mid layui-word-aux">多少件起卖，0表示不限购</div>
									</div>
									<div class="layui-form-item">
										<label class="layui-form-label">每人限购：</label>
										<div class="layui-input-inline">
											<input type="text" name="info[perlimit]" value="{$info['id']?$info['perlimit']:'0'}" class="layui-input">
										</div>
										<div class="layui-form-mid layui-word-aux">每人最多可购买多少件，0表示不限购</div>
									</div>
									<div class="layui-form-item">
										<label class="layui-form-label">每单限购：</label>
										<div class="layui-input-inline">
											<input type="text" name="info[perlimitdan]" value="{$info['id']?$info['perlimitdan']:'0'}" class="layui-input">
										</div>
										<div class="layui-form-mid layui-word-aux">每单最多可购买多少件，0表示不限购</div>
									</div>
									<div class="layui-form-item">
										<label class="layui-form-label">序号：</label>
										<div class="layui-input-inline">
											<input type="text" name="info[sort]" value="{$info['sort']?$info['sort']:'0'}" class="layui-input">
										</div>
										<div class="layui-form-mid layui-word-aux">用于排序,越大越靠前</div>
									</div>

									{if getcustom('shop_product_recommend')}
									<div class="layui-form-item">
										<label class="layui-form-label" style="width:100px">商品推荐：</label>
										<div class="layui-input-inline" style="width:500px">
											<input type="radio" name="info[show_recommend]" value="0" {if !info['id'] || $info['show_recommend']==0}checked{/if} title="关闭" lay-filter="show_recommend"/>
											<input type="radio" name="info[show_recommend]" value="1" {if $info['show_recommend']==1}checked{/if} title="随机" lay-filter="show_recommend"/>
											<input type="radio" name="info[show_recommend]" value="2" {if $info['show_recommend']==2}checked{/if} title="自选" lay-filter="show_recommend"/>
										</div>
									</div>
									<div class="show_recommend2" style="clear:both;{if $info['show_recommend']!=2}display:none{/if}">
										<label class="layui-form-label" style="width:100px"></label>
										<div class="layui-input-inline" style="width:auto">
											<table id="setproductdiv"  class="layui-table" style="width:500px">
												<thead>
												<tr>
													<th>商品ID</th>
													<th>商品名称</th>
													<th>操作</th>
												</tr>
												</thead>
												{php}
												$productdata = array();
												if($info && $info['recommend_productids']){
													$productdata = \think\facade\Db::name('shop_product')->where('aid',aid)->where('id','in',$info['recommend_productids'])->order(\think\facade\Db::raw('field(id,'.$info['recommend_productids'].')'))->select()->toArray();
												}
												{/php}
												{if $productdata}
												{foreach $productdata as $k=>$ff}
												<tr class="productlisttr"><td>{$ff.id}</td><td>{$ff.name}</td><td><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="delProduct(this,{$ff.id})">删除</button></td></tr>
												{/foreach}
												{/if}
												<tr id="productaddtr">
													<td colspan="3"><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="showChooseProduct()">添加</button></td>
												</tr>
											</table>
											<input type="hidden" name="info[recommend_productids]" value="{$info.recommend_productids}"/>
										</div>
									</div>
									<script>
									var chooseProductLayer;
									function showChooseProduct(){
										chooseProductLayer = layer.open({type:2,title:'选择商品',content:"{:url('ShopProduct/chooseproduct')}/type/2/hidebid/1",area:['1000px','600px'],shadeClose:true});
									}
									function choosepro2(res){
										console.log(res)
										var product = res.product
										layer.close(chooseProductLayer);
										var recommend_productids = [];
										var isadd = 0;
										$('.productlisttr').each(function(){
											var thisfid = $(this).find('td:eq(0)').html();
											if(thisfid == product.id){
												isadd = 1
												dialog('该商品已添加过了');
											}
											recommend_productids.push(thisfid)
										})
										if(isadd == 0){
											recommend_productids.push(product.id)
											$("input[name='info[recommend_productids]']").val(recommend_productids.join(','));
											$('#productaddtr').before('<tr class="productlisttr"><td>'+product.id+'</td><td>'+product.name+'</td><td><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="delProduct(this,'+product.id+')">删除</button></td></tr>');
										}
										console.log(recommend_productids)
									}
									function delProduct(obj,fid){
										$(obj).parent().parent().remove();
										var recommend_productids = [];
										$('.productlisttr').each(function(){
											recommend_productids.push($(this).find('td:eq(0)').html())
										})
										$("input[name='info[recommend_productids]']").val(recommend_productids.join(','));
									}
									</script>
									{/if}

									{if getcustom('plug_tengrui')}
									<div class="layui-form-item">
										<label class="layui-form-label" style="width:100px">认证{:t('会员')}：</label>
										<div class="layui-input-inline">
											<input type="radio" name="info[is_rzh]" value="0" {if !$info['id'] || $info['is_rzh']==0}checked{/if} title="否"/>
											<input type="radio" name="info[is_rzh]" value="1" {if $info['id'] && $info['is_rzh']==1}checked{/if} title="是"/>
										</div>
									</div>
									<div class="layui-form-item">
										<label class="layui-form-label" style="width:100px">{:t('会员')}关系：</label>
										<div class="layui-input-inline" style="width:500px">
										<input type="radio" name="info[relation_type]" value="-1" {if !$info['id'] || $info['relation_type']==-1}checked{/if} title="所有"/>
											<input type="radio" name="info[relation_type]" value="0" {if $info['id'] && $info['relation_type']==0}checked{/if} title="业主"/>
											<input type="radio" name="info[relation_type]" value="1" {if $info['id'] && $info['relation_type']==1}checked{/if} title="家属"/>
											<input type="radio" name="info[relation_type]" value="2" {if $info['id'] && $info['relation_type']==2}checked{/if} title="租户"/>
											<input type="radio" name="info[relation_type]" value="3" {if $info['id'] && $info['relation_type']==3}checked{/if} title="买断"/>
											<input type="radio" name="info[relation_type]" value="4" {if $info['id'] && $info['relation_type']==4}checked{/if} title="租用"/>
										</div>
									</div>
									<div class="layui-form-item">
										<label class="layui-form-label" style="width:100px">一户仅限一次：</label>
										<div class="layui-input-inline">
											<input type="radio" name="info[house_status]" value="0" {if $info['id'] && $info['house_status']==0}checked{/if} title="否"/>
											<input type="radio" name="info[house_status]" value="1" {if !$info['id'] || $info['house_status']==1}checked{/if} title="是"/>
										</div>
										<div class="layui-form-mid layui-word-aux" style="margin-left:10px;">需是认证用户，且同一个小区的同一户只限一人购买，即一户仅限一次</div>
									</div>
									<div class="layui-form-item">
										<label class="layui-form-label" style="width:100px">授权小区：</label>
										<div class="layui-input-inline" style="width:500px">
											<input type="radio" name="info[group_status]" value="0" {if $info['group_status']==0}checked{/if} title="关闭" lay-filter="group_status"/>
											<input type="radio" name="info[group_status]" value="1" {if $info['group_status']==1}checked{/if} title="开启" lay-filter="group_status"/>
										</div>
										<div class="group_status1 fwtypeExtend" style="clear:both;{if $info['group_status']!=1}display:none{/if}">
											<label class="layui-form-label" style="width:100px"></label>
											<div class="layui-input-inline" style="width:auto">
												<table id="setgroupdiv"  class="layui-table" style="width:500px">
													<thead>
													<tr>
														<th>小区ID</th>
														<th>小区名称</th>
														<th>操作</th>
													</tr>
													</thead>
													{if $groupdata}
													{foreach $groupdata as $gk=>$gv}
													<tr class="grouplisttr"><td>{$gv.id}</td><td>{$gv.fullName}</td><td><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="delGroup(this,{$gv.id})">删除</button></td></tr>
													{/foreach}
													{/if}
													<tr id="groupaddtr">
														<td colspan="3"><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="showChooseGroup()">添加</button></td>
													</tr>
												</table>
												<input type="hidden" name="info[group_ids]" value="{$info.group_ids}"/>
											</div>
										</div>
										<script>
										var chooseGroupLayer;
										function showChooseGroup(){
											chooseGroupLayer = layer.open({type:2,title:'选择分组',content:"{:url('MemberTrGroup/choosegroup')}",area:['1000px','600px'],shadeClose:true});
										}
										function chooseGroup(fid,fname){
											layer.close(chooseGroupLayer);
											var group_ids = [];
											var isadd = 0;
											$('.grouplisttr').each(function(){
												var thisfid = $(this).find('td:eq(0)').html();
												if(thisfid == fid){
													isadd = 1
													dialog('该分组已添加过了');
												}
												group_ids.push(thisfid)
											})
											if(isadd == 0){
												group_ids.push(fid)
												$("input[name='info[group_ids]']").val(group_ids.join(','));
												$('#groupaddtr').before('<tr class="grouplisttr"><td>'+fid+'</td><td>'+fname+'</td><td><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="delGroup(this,'+fid+')">删除</button></td></tr>');
											}
											console.log(group_ids)
										}
										function delGroup(obj,fid){
											$(obj).parent().parent().remove();
											var group_ids = [];
											$('.grouplisttr').each(function(){
												group_ids.push($(this).find('td:eq(0)').html())
											})
											$("input[name='info[group_ids]']").val(group_ids.join(','));
										}
										</script>
									</div>
									{/if}
									{if $bid==0 || $bset['product_showset']==1}
									<div class="layui-form-item">
										<label class="layui-form-label">显示条件：</label>
										<div class="layui-input-inline" style="width:800px">
											<input type="checkbox" name="info[showtj][]" value="-1" title="所有人" lay-skin="primary" {if !$info['id'] || in_array('-1',$info['showtj'])}checked{/if}/>
											<input type="checkbox" name="info[showtj][]" value="0" title="关注用户" lay-skin="primary" {if in_array('0',$info['showtj'])}checked{/if}/>
											{foreach $levellist as $v}
											<input type="checkbox" name="info[showtj][]" value="{$v.id}" title="{$v.name}" lay-skin="primary" {if in_array($v['id'],$info['showtj'])}checked{/if}/>
											{/foreach}
										</div>
									</div>
									<div class="layui-form-item">
										<label class="layui-form-label">购买条件：</label>
										<div class="layui-input-inline" style="width:800px">
											<input type="checkbox" name="info[gettj][]" value="-1" title="所有人" lay-skin="primary" {if !$info['id'] || in_array('-1',$info['gettj'])}checked{/if} lay-filter="gettjset"/>
											<input type="checkbox" name="info[gettj][]" value="0" title="关注用户" lay-skin="primary" {if in_array('0',$info['gettj'])}checked{/if}/>
											{foreach $levellist as $v}
											<input type="checkbox" name="info[gettj][]" value="{$v.id}" title="{$v.name}" lay-skin="primary" {if in_array($v['id'],$info['gettj'])}checked{/if}/>
											{/foreach}
										</div>
									</div>
									{/if}

									

									<div id="gettjset" {if !$info['id'] || in_array('-1',$info['gettj'])}style="display:none"{/if}>
										<div class="layui-form-item">
											<div class="layui-form-label">无权限提示：</div>
											<div class="layui-input-inline">
												<input class="layui-input" name="info[gettjtip]" value="{if !$info['id']}您没有权限购买该商品{else}{$info.gettjtip}{/if}"/>
											</div>
											<div class="layui-form-mid"></div>
										</div>
										<div class="layui-form-item">
											<div class="layui-form-label">无权限跳转：</div>
											<div class="layui-input-inline">
												<input class="layui-input" name="info[gettjurl]" value="{$info.gettjurl}" id="gettjurl"/>
											</div>
											<div class="layui-btn layui-btn-primary" style="float:left" onclick="chooseUrl2('gettjurl')">选择链接</div>
										</div>
									</div>
									{if getcustom('buy_selectmember')}
									<div class="layui-form-item">
										<div class="layui-form-label">尾款：</div>
										<div class="layui-input-inline">
											<input class="layui-input" name="info[balance]" value="{$info.balance}"/>
										</div>
										<div class="layui-form-mid">%</div>
									</div>
									{/if}
									{if getcustom('payaftertourl')}
									<div class="layui-form-item">
										<div class="layui-form-label">支付后跳转：</div>
										<div class="layui-input-inline" style="width:500px">
											<input class="layui-input" name="info[payaftertourl]" id="payaftertourl" value="{$info.payaftertourl}"/>
										</div>
										<div class="layui-btn layui-btn-primary" style="float:left" onclick="chooseUrl2('payaftertourl')">选择链接</div>
									</div>
									<div class="layui-form-item">
										<div class="layui-form-label">按钮文本：</div>
										<div class="layui-input-inline">
											<input class="layui-input" name="info[payafterbtntext]" value="{$info.payafterbtntext}"/>
										</div>
									</div>
									{/if}
									  {if getcustom('everyday_hongbao') && $ehb_status}
		  <div class="layui-form-item">
			  <div class="layui-form-label">红包额度比例：</div>
			  <div class="layui-input-inline" style="width: 400px;">
				  <input class="layui-input" name="info[everyday_hongbao_bl]" value="{$info.everyday_hongbao_bl}"/>
				  <div class="layui-form-mid layui-word-aux">购买商品给{:t('会员')}的红包额度，留空使用系统设置比例，0则不参与红包活动</div>
			  </div>

			  <div class="layui-form-mid layui-word-aux">%</div>
		  </div>
									  {/if}
									
									<div class="layui-form-item" {if !getcustom('level_comwithdraw')}style="display:none"{/if}>
										<label class="layui-form-label">会员折扣：</label>
										<div class="layui-input-inline" style="width:600px">
											<input type="radio" name="info[no_discount]" value="0" title="参与" {if !$info['id'] || $info['no_discount']==0}checked{/if}/>
											<input type="radio" name="info[no_discount]" value="1" title="不参与" {if $info['id'] && $info['no_discount']==1}checked{/if}/>
										</div>
									</div>

									{if getcustom('product_moneypay')}
									<div class="layui-form-item">
										<label class="layui-form-label">余额支付：</label>
										<div class="layui-input-inline" style="width:600px">
											<input type="radio" name="info[product_moneypay]" value="1" title="支持" {if !$info['id'] || $info['product_moneypay']==1}checked{/if}/>
											<input type="radio" name="info[product_moneypay]" value="0" title="不支持" {if $info['id'] && $info['product_moneypay']==0}checked{/if}/>
										</div>
									</div>
									{/if}
									
									<div class="layui-form-item">
										<label class="layui-form-label">状态：</label>
										<div class="layui-input-inline" style="width:600px">
											<input type="radio" name="info[status]" value="1" title="已上架" {if !$info['id'] || $info['status']==1}checked{/if} lay-filter="set_status"/>
											<input type="radio" name="info[status]" value="0" title="未上架" {if $info['id'] && $info['status']==0}checked{/if} lay-filter="set_status"/>
											<input type="radio" name="info[status]" value="2" title="设置上架时间" {if $info['id'] && $info['status']==2}checked{/if} lay-filter="set_status"/>
											<input type="radio" name="info[status]" value="3" title="设置上架周期" {if $info['id'] && $info['status']==3}checked{/if} lay-filter="set_status"/>
										</div>
									</div>
									
									<div class="layui-form-item" id="set_status2" {if $info['status']!=2}style="display:none"{/if}>
										<label class="layui-form-label">上架时间：</label>
										<div class="layui-input-inline" style="width:150px">
											<input type="text" name="info[start_time]" class="layui-input" value="{$info.start_time}" id="start_time" autocomplete="off">
										</div>
										<div class="layui-form-mid">到</div>
										<div class="layui-input-inline" style="width:150px">
											<input type="text" name="info[end_time]" class="layui-input" value="{$info.end_time}" id="end_time" autocomplete="off">
										</div>
										<div class="layui-form-mid layui-word-aux" style="clear:left;margin-left:110px"></div>
									</div>
									<div class="layui-form-item" id="set_status3" {if $info['status']!=3}style="display:none"{/if}>
										<label class="layui-form-label">上架周期：</label>
										<div class="layui-input-inline" style="width:150px">
											<input type="text" name="info[start_hours]" class="layui-input" value="{$info.start_hours}" id="start_hours" autocomplete="off">
										</div>
										<div class="layui-form-mid">到</div>
										<div class="layui-input-inline" style="width:150px">
											<input type="text" name="info[end_hours]" class="layui-input" value="{$info.end_hours}" id="end_hours" autocomplete="off">
										</div>
										<div class="layui-form-mid layui-word-aux" style="clear:left;margin-left:110px">结束时间小于或等于开始时间表示跨天,如:16:00到06:00表示下午4点到次日早晨6点</div>
									</div>
									
									{if $fromwxvideo}
									<div class="layui-form-item">
										<label class="layui-form-label">类目ID：</label>
										<div class="layui-input-inline" style="width:200px">
											<input type="text" name="info[wxvideo_third_cat_id]" lay-verify="required" lay-verType="tips" class="layui-input" value="{$info['wxvideo_third_cat_id']}">
										</div>
										<button type="button" class="layui-btn layui-btn-primary" onclick="showChooseCategory()">选择</button>
									</div>
									<div class="layui-form-item">
										<label class="layui-form-label">品牌：</label>
										<div class="layui-input-inline" style="width:200px">
											<select name="info[wxvideo_brand_id]">
												{foreach $brand_list as $v}
												<option value="{$v.brand_id}" {if $info['wxvideo_brand_id'] == $v['brand_id']}selected{/if}>{$v.brand_wording}</option>
												{/foreach}
											</select>
										</div>
									</div>
									
									<div class="layui-form-item" id="trademark_registration_certificate_div">
										<label class="layui-form-label">资质图片：</label>
										<input type="hidden" name="info[wxvideo_qualification_pics]" value="{$info['wxvideo_qualification_pics']}" id="wxvideo_qualification_pics">
										<button style="float:left;" type="button" class="layui-btn layui-btn-primary" onclick="uploader(this,true)" upload-input="wxvideo_qualification_pics" upload-preview="qualification_picsList" >上传图片</button>
										<div class="layui-form-mid layui-word-aux" style="margin-left:10px;">如所选类目需要商品资质，请在此上传</div>
										<div id="qualification_picsList" style="float:left;padding-top:10px;padding-left:110px;clear: both;">
											{if $info['wxvideo_qualification_pics']}{php}$pics = explode(',',$info['wxvideo_qualification_pics']);{/php}{foreach $pics as $pic}
											<div class="layui-imgbox">
												<a class="layui-imgbox-close" href="javascript:void(0)" onclick="$(this).parent().remove();getpicsval('wxvideo_qualification_pics','qualification_picsList')" title="删除"><i class="layui-icon layui-icon-close-fill"></i></a>
												<span class="layui-imgbox-img"><img src="{$pic}"></span>
											</div>
											{/foreach}{/if}
										</div>
									</div>
									{/if}

									
									<div class="layui-form-item">
										<label class="layui-form-label"></label>
										<div class="layui-input-block">
											<button class="layui-btn layui-btn-normal" onclick="gonext(2)">下一步:编辑商品参数</button>
											<button class="layui-btn layui-btn-danger" lay-submit lay-filter="formsubmit">提 交</button>
										</div>
									</div>

								</div>

								<div class="layui-tab-item">
									<div class="paramTab">
										{if !$paramList}<div class="layui-form-item"><label class="layui-form-label"></label><div class="layui-form-mid">暂未添加商品参数或当前商品分类下无参数，<a href="javascript:void(0)" onclick="openmax('{:url('ShopParam/index')}&isopen=1')">去添加</a></div></div>{/if}
										{foreach $paramList as $k=>$param}
										<div class="layui-form-item">
											<label class="layui-form-label">{if $param['is_required']==1}<span class="redstar">*</span>{/if}{$param.name}：</label>
											{if $param.type == '0'}
											<div class="layui-input-inline" style="width:240px">
												<input type="text" class="layui-input" name="paramdata[{$param.name}]" value="{$paramdata[$param['name']]}" {if $param['is_required']==1}lay-verify="required" lay-verType="tips"{/if} placeholder="{$param.tips}"/>
											</div>
											{elseif $param.type == '1'}
											<div class="layui-input-inline" style="width:240px">
												<select name="paramdata[{$param.name}]" {if $param['is_required']==1}lay-verify="required" lay-verType="tips"{/if}>
												<option value="">{$param.tips}</option>
												{php} $params = json_decode($param['params'],true);{/php}
												{foreach $params as $pm}<option {if $paramdata[$param['name']] == $pm}selected{/if}>{$pm}</option>{/foreach}
												</select>
											</div>
											{elseif $param.type == '2'}
											<div class="layui-input-inline" style="width:500px">
												{php} $params = json_decode($param['params'],true);{/php}
												{foreach $params as $pm}
												<input type="checkbox" name="paramdata[{$param.name}][]" value="{$pm}" title="{$pm}" lay-skin="primary" {if in_array($pm,$paramdata[$param['name']])}checked{/if}>
												{/foreach}
											</div>
											<div class="layui-form-mid layui-word-aux" style="clear:left;margin-left:130px">{$param.tips}</div>
											{/if}
										</div>
										{/foreach}
									</div>

									<div class="layui-form-item">
										<label class="layui-form-label"></label>
										<div class="layui-input-block">
											<button class="layui-btn layui-btn-normal" onclick="gonext(3)">下一步:编辑商品详情</button>
											<button class="layui-btn layui-btn-danger" lay-submit lay-filter="formsubmit">提 交</button>
										</div>
									</div>
									<div class="layui-form-item">
										<label class="layui-form-label"></label>
										<div class="layui-input-inline" style="width:500px"></div>
										<div class="layui-form-mid layui-word-aux">使用商品对应的分类参数+未关联分类参数</div>
									</div>
								</div>

								<div class="layui-tab-item">
									<!-- 详情编辑器 -->
									<!-- <div class="layui-form-item">
										<label class="layui-form-label">商品详情</label>
										<div class="layui-input-inline" style="width:500px">
											<script id="content" name="info[detail]" type="text/plain" style="width:100%;height:500px">{$info['detail']}</script>
										</div>
									</div> -->
									<!-- 详情编辑器 -->
									<?php 
									$pagetitle='商品详情';
									$pagedata= $info['detail'] && json_decode($info['detail']) ? $info['detail'] : '[{"id":"M0000000000000","temp":"richtext","params":{bgcolor:"#FFFFFF",margin_x:"0",margin_y:"0",padding_x:"10",padding_y:"10","quanxian":{"all":true},"platform":{"all":true}},"data":"","other":"","content":""}]';
									?>
									{include file="designer_page/designer_editor" /}

									<div class="layui-form-item">
										<label class="layui-form-label"></label>
										<div class="layui-input-block">
											<button class="layui-btn layui-btn-normal" onclick="gonext(2)">上一步:编辑商品参数</button>
											<button class="layui-btn layui-btn-danger" lay-submit lay-filter="formsubmit">提 交</button>
										</div>
									</div>
								</div>
								<div class="layui-tab-item">
									<div class="layui-form-item">
										<label class="layui-form-label">分享标题：</label>
										<div class="layui-input-inline" style="width:300px">
											<input type="text" class="layui-input" name="info[sharetitle]" value="{$info.sharetitle}"/>
										</div>
										<div class="layui-form-mid layui-word-aux">默认为商品名称</div>
									</div>
									<div class="layui-form-item">
										<label class="layui-form-label">分享图标：</label>
										<input type="hidden" name="info[sharepic]" id="sharepic" lay-verType="tips" class="layui-input" value="{$info.sharepic}">
										<button style="float:left;" type="button" class="layui-btn layui-btn-primary" upload-input="sharepic" upload-preview="sharepicPreview" onclick="uploader(this)">上传图片</button>
										<div class="layui-form-mid layui-word-aux" style="margin-left:10px;">建议尺寸：400*400像素，默认为商品主图</div>
										<div id="sharepicPreview" style="float:left;padding-top:10px;padding-left:130px;clear: both;">
											<div class="layui-imgbox" style="width:100px;"><div class="layui-imgbox-img"><img src="{$info.sharepic}"/></div></div>
										</div>
									</div>
									<div class="layui-form-item">
										<label class="layui-form-label">分享描述：</label>
										<div class="layui-input-inline" style="width:300px">
											<input type="text" class="layui-input" name="info[sharedesc]" value="{$info.sharedesc}"/>
										</div>
										<div class="layui-form-mid layui-word-aux">默认为商品卖点</div>
									</div>
									<!-- <div class="layui-form-item">
										<label class="layui-form-label">分享链接：</label>
										<div class="layui-input-inline" style="width:300px">
											<input type="text" class="layui-input" name="info[sharelink]" value="{$info.sharelink}"/>
										</div>
										<div class="layui-form-mid layui-word-aux">默认为商品链接，非特殊需求无需填写</div>
									</div> -->
									<div class="layui-form-item">
										<label class="layui-form-label"></label>
										<div class="layui-input-block">
											<button class="layui-btn layui-btn-normal" onclick="gonext(3)">上一步:编辑商品详情</button>
											<button class="layui-btn layui-btn-danger" lay-submit lay-filter="formsubmit">提 交</button>
										</div>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
  </div>
	<video id="myvideo" style="display:none"></video>
	<script>
		var formSelects = layui.formSelects;
	layui.form.on('radio(group_status)',function(data){
		if(data.value == 1){
			$('.group_status1').show();
		}else{
			$('.group_status1').hide();
		}
		
	})
	$(".layui-form input#video").bind("input change propertychange",function(event){
		var videourl = $('#video').val();
		if(videourl){
			$("#myvideo").prop("src", videourl);
			$("#myvideo")[0].addEventListener("loadedmetadata", function() {
				var tol = Math.floor(this.duration); //获取总时长
				$('#video_duration').val(tol);
			});
		}else{
			$('#video_duration').val(0);
		}
	})
	//var ueditor = UE.getEditor('content');
	layui.form.on('radio(freighttypeset)', function(data){
		if(data.value == '1'){
			$('#setfreight').hide();
			$('#freighttype3').hide();
			$('#freighttype4').hide();
		}else if(data.value == '3'){
			$('#setfreight').hide();
			$('#freighttype3').show();
			$('#freighttype4').hide();
		}else if(data.value == '4'){
			$('#setfreight').hide();
			$('#freighttype3').hide();
			$('#freighttype4').show();
		}else{
			$('#setfreight').show();
			$('#freighttype3').hide();
			$('#freighttype4').hide();
		}
	})
	
	layui.form.on('radio(set_status)',function(data){
		if(data.value=="0" || data.value=="1"){
			$('#set_status2').hide();
			$('#set_status3').hide();
		}
		if(data.value=="2"){
			$('#set_status2').show();
			$('#set_status3').hide();
		}
		if(data.value=="3"){
			$('#set_status2').hide();
			$('#set_status3').show();
		}
	});
	
	layui.laydate.render({ 
		elem: '#start_hours',
		type: 'time',
		format:'HH:mm',
		trigger: 'click'
	});
	layui.laydate.render({ 
		elem: '#end_hours',
		type: 'time',
		format:'HH:mm',
		trigger: 'click'
	});
	layui.laydate.render({ 
		elem: '#start_time',
		type: 'datetime',
		trigger: 'click'
	});
	layui.laydate.render({ 
		elem: '#end_time',
		type: 'datetime',
		trigger: 'click'
	});

	layui.form.on('switch(isfuwu)',function(data){
		if(data.elem.checked){
			$('#isfuwudiv').show();
		}else{
			$('#isfuwudiv').hide();
		}
	})
	layui.form.on('radio(commissionset)', function(data){
		if(data.value == '1'){
			$('#commissionset1').show();
			$('#commissionset2').hide();
			$('#commissionset3').hide();
		}else if(data.value == '2'){
			$('#commissionset1').hide();
			$('#commissionset2').show();
			$('#commissionset3').hide();
		}else if(data.value == '3'){
			$('#commissionset1').hide();
			$('#commissionset2').hide();
			$('#commissionset3').show();
		}else{
			$('#commissionset1').hide();
			$('#commissionset2').hide();
			$('#commissionset3').hide();
		}
	});
	layui.form.on('radio(commissionpingjiset)', function(data){
		if(data.value == '1'){
			$('#commissionpingjiset1').show();
			$('#commissionpingjiset2').hide();
		}else if(data.value == '2'){
			$('#commissionpingjiset1').hide();
			$('#commissionpingjiset2').show();
		}else{
			$('#commissionpingjiset1').hide();
			$('#commissionpingjiset2').hide();
		}
	})
	layui.form.on('radio(fenhongset)', function(data){
		if(data.value == '1'){
			$('#fenhongset').show();
		}else{
			$('#fenhongset').hide();
		}
	})
	layui.form.on('radio(teamfenhongset)', function(data){
		if(data.value == '1'){
			$('#teamfenhongset1').show();
			$('#teamfenhongset2').hide();
		}else if(data.value == '2'){
			$('#teamfenhongset1').hide();
			$('#teamfenhongset2').show();
		}else{
			$('#teamfenhongset1').hide();
			$('#teamfenhongset2').hide();
		}
	})
	layui.form.on('radio(gdfenhongset)', function(data){
		if(data.value == '1'){
			$('#gdfenhongset1').show();
			$('#gdfenhongset2').hide();
		}else if(data.value == '2'){
			$('#gdfenhongset1').hide();
			$('#gdfenhongset2').show();
		}else{
			$('#gdfenhongset1').hide();
			$('#gdfenhongset2').hide();
		}
	})
	layui.form.on('radio(areafenhongset)', function(data){
		if(data.value == '1'){
			$('#areafenhongset1').show();
			$('#areafenhongset2').hide();
		}else if(data.value == '2'){
			$('#areafenhongset1').hide();
			$('#areafenhongset2').show();
		}else{
			$('#areafenhongset1').hide();
			$('#areafenhongset2').hide();
		}
	})
	layui.form.on('radio(teamfenhongpjset)', function(data){
		if(data.value == '1'){
			$('#teamfenhongpjset1').show();
			$('#teamfenhongpjset2').hide();
		}else if(data.value == '2'){
			$('#teamfenhongpjset1').hide();
			$('#teamfenhongpjset2').show();
		}else{
			$('#teamfenhongpjset1').hide();
			$('#teamfenhongpjset2').hide();
		}
	})
	layui.form.on('radio(scoredkmaxset)', function(data){
		if(data.value == '1'){
			$('#scoredkmaxset1').show();
			$('#scoredkmaxunit').html('%');
		}else if(data.value == '2'){
			$('#scoredkmaxset1').show();
			$('#scoredkmaxunit').html('元');
		}else{
			$('#scoredkmaxset1').hide();
		}
	})
		function gonext(layid){
			$(window).scrollTop(0);
			layui.element.tabChange('mytab', layid);
		}
		layui.element.on('tab(mytab)', function(){
			try{
				changeconentxy();
			}catch(e){}
		})
		//var ueditor = UE.getEditor('editor');
		var oldgglist = {:json_encode($newgglist)};
		$(function(){
			refreshgg();
		})
		function addggtype(){
			var gghtml = '<tr>';
			gghtml += '<td><input type="text" name="ggname" class="layui-input" value="" style="width:120px" placeholder="请输入规格分组"/></td>';
			gghtml += '<td><div><input type="text" class="layui-input" style="width:180px" value="" placeholder="请输入规格名称"> <button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="addggname(this)" style="margin-top:-3px;"><i class="fa fa-plus" style="font-size:14px!important"></i></button></div></td>';
			gghtml += '<td><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="$(this).parent().parent().remove()">删除</button></td>';
			gghtml += '</tr>';
			$('#ggnamediv').append(gghtml);
		}
		function addggname(obj){
			var ggnameobj = $(obj).parent().parent().append('<div><input class="layui-input" type="text" style="width:180px" value="" placeholder="请输入规格名称"> <button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="$(this).parent().remove()" style="margin-top:-3px;"><i class="fa fa-remove" style="font-size:14px!important"></i></button></div>');
		}
		function lvpriceset(){
			var lvprice = $("input[name='info[lvprice]']").val();
			if(lvprice == 0){
				$("input[name='info[lvprice]']").val('1');
				$('#lvpricebtn').text('关闭会员价');
				$('#commissionset4input').show();
				$('#commissionset4tips').show();
				//layui.form.render();
			}else{
				$("input[name='info[lvprice]']").val('0');
				$('#lvpricebtn').text('开启会员价');
				$('#commissionset4input').hide();
				$('#commissionset4tips').hide();
			}
			refreshgg()
		}
		var specs = [];
		function refreshgg(){
			var haskong = 0
			$('#ggnamediv').find("input").each(function(){
				if($(this).val()=='') haskong = 1
			})
			if(haskong){
				layer.msg('请填写完整');return;
			}
			var lvprice = $("input[name='info[lvprice]']").val();
			specs = [];
			var i=0;
			$('input[name=ggname]').each(function(){
				var ggval = [];
				var j=0;
				$(this).parent().next().find('input').each(function(){
					ggval.push({ 'k':j,'title':$(this).val()});
					j++
				})
				specs.push({ 'k':i,'title':$(this).val(),'items':ggval});
				i++;
			});
			console.log(specs)
			var len = specs.length;
			var newlen = 1; 
			var h = new Array(len); 
			var rowspans = new Array(len); 
			
			var html = '<thead><tr>';
			for(var i=0;i<len;i++){
				html+="<th>" + specs[i].title + "</th>";
				var itemlen = specs[i].items.length;
				if(itemlen<=0) { itemlen = 1 };
				newlen*=itemlen;
				h[i] = new Array(newlen);
				for(var j=0;j<newlen;j++){
					h[i][j] = new Array();
				}
				var l = specs[i].items.length;
				rowspans[i] = 1;
				for(j=i+1;j<len;j++){
					rowspans[i]*= specs[j].items.length;
				}
			}
			html += '<th>规格编号</th>';
			html += '<th>市场价（元）</th>';
			html += '<th>成本价（元）</th>';
			if(lvprice==1){
				{foreach $levellist as $level}
				html += '<th>{$level.name}（元）</th>';
				{/foreach}
			}else{
				html += '<th>销售价（元）</th>';
			}
			html += '<th>重量（克）</th>';
			html += '<th>库存</th>';
			{if $bid==0}
			html += '<th>赠{:t('积分')}(个)</th>';
			{/if}
			{if getcustom('guige_limit_start')}
			html += '<th>起售数量</th>';
			{/if}
			html += '<th>图片</th>';
			html += '</tr></thead>';
			
			for(var m=0;m<len;m++){
				var k = 0,kid = 0,n=0;
				for(var j=0;j<newlen;j++){
					var rowspan = rowspans[m]; 
					if( j % rowspan==0){
						h[m][j]={ k:specs[m].items[kid].k,title: specs[m].items[kid].title, html: "<td rowspan='" +rowspan + "'>"+ specs[m].items[kid].title+"</td>\r\n",id: specs[m].items[kid].id};
					}else{
						h[m][j]={ k:specs[m].items[kid].k,title:specs[m].items[kid].title, html: "",id: specs[m].items[kid].id};	
					}
					n++;
					if(n==rowspan){
						kid++; if(kid>specs[m].items.length-1) { kid=0; }
						n=0;
					}
				}
			}

			var hh = "";
			for(var i=0;i<newlen;i++){
				hh+="<tr>";
				var ks = [];
				var titles = [];
				for(var j=0;j<len;j++){
					hh+=h[j][i].html; 
					ks.push( h[j][i].k);
					titles.push( h[j][i].title);
				}
				ks2 =ks.join('_');
				ks =ks.join(',');
				titles =titles.join(',');
				if(typeof(oldgglist[ks])!='undefined'){
					var val = oldgglist[ks];
				}else{
					var val = { procode:'',market_price:'',cost_price:'',sell_price:'',weight:'100',stock:'1000',givescore:'0',pic:'',lvprice_data:null};
				}
			
				//hh += '<td>';
				//hh += '	<input name="option['+ks+'][procode]" class="layui-input" type="text" style="width:100px" value="'+(val.procode==null?'':val.procode)+'"/>';
				//if(i==0){
				//	hh += ' <i class="fa fa-hand-o-down" style="cursor:pointer" title="批量设置" onclick="plset(\'procode\')"></i>';
				//}
				// hh += '</td>';
				hh += '<td>';
				hh += '	<input name="option['+ks+'][barcode]" class="layui-input" type="text" style="width:100px" value="'+(val.barcode==null?'':val.barcode)+'"/>';
				if(i==0){
					hh += ' <i class="fa fa-hand-o-down" style="cursor:pointer" title="批量设置" onclick="plset(\'barcode\')"></i>';
				}
				hh += '</td>';
				hh += '<td>';
				hh += '	<input name="option['+ks+'][name]" type="hidden" value="'+titles+'" class="layui-input"/><input name="option['+ks+'][market_price]" type="text" class="layui-input" style="width:70px" value="'+(val.market_price==null?'':val.market_price)+'"/>';
				if(i==0){
					hh += ' <i class="fa fa-hand-o-down" style="cursor:pointer" title="批量设置" onclick="plset(\'market_price\')"></i>';
				}
				hh += '</td>';
				hh += '<td>';
				hh += '	<input name="option['+ks+'][cost_price]" type="text" class="layui-input" style="width:70px" value="'+(val.cost_price==null?'':val.cost_price)+'"/>';
				if(i==0){
					hh += ' <i class="fa fa-hand-o-down" style="cursor:pointer" title="批量设置" onclick="plset(\'cost_price\')"></i>';
				}
				hh += '</td>';
				if(lvprice==1){
					{foreach $levellist as $lk=>$level}
					hh += '<td>';
					hh += '	<input name="option['+ks+'][sell_price_{$level.id}]" type="text" style="width:70px" value="'+(val.lvprice_data==null || val.lvprice_data[{$level.id}]==null?'':val.lvprice_data[{$level.id}])+'" class="layui-input" id="levelprice_'+i+'_{$lk}"/>';
					if(i==0){
						{if $lk==0}
						hh += ' <i class="fa fa-hand-o-down" style="cursor:pointer" title="批量设置" onclick="plset(\'sell_price_{$level.id}\')"></i>';
						{else}
						hh += ' <i class="fa fa-hand-o-down" style="cursor:pointer" title="批量设置" onclick="plsetlevelprice(\''+i+'\',\'{$lk}\')"></i>';
						{/if}
					}
					hh += '</td>';
					{/foreach}
				}else{
					hh += '<td>';
					hh += '	<input name="option['+ks+'][sell_price]" type="text" style="width:70px" value="'+(val.sell_price==null?'':val.sell_price)+'" class="layui-input"/>';
					if(i==0){
						hh += ' <i class="fa fa-hand-o-down" style="cursor:pointer" title="批量设置" onclick="plset(\'sell_price\')"></i>';
					}
					hh += '</td>';
				}
				hh += '<td>';
				hh += ' <input name="option['+ks+'][weight]" type="text" style="width:60px" value="'+(val.weight==null?'':val.weight)+'" class="layui-input"/>';
				if(i==0){
					hh += ' <i class="fa fa-hand-o-down" style="cursor:pointer" title="批量设置" onclick="plset(\'weight\')"></i>';
				}
				hh += '</td>';
				hh += '<td>';
				hh += ' <input name="option['+ks+'][stock]" type="text" style="width:60px" value="'+(val.stock==null?'':val.stock)+'" class="layui-input"/>';
				if(i==0){
					hh += ' <i class="fa fa-hand-o-down" style="cursor:pointer" title="批量设置" onclick="plset(\'stock\')"></i>';
				}
				hh += '</td>';
				{if $bid==0}
				hh += '<td>';
				hh += ' <input name="option['+ks+'][givescore]" type="text" style="width:60px" value="'+(val.givescore==null?'':val.givescore)+'" class="layui-input"/>';
				if(i==0){
					hh += ' <i class="fa fa-hand-o-down" style="cursor:pointer" title="批量设置" onclick="plset(\'givescore\')"></i>';
				}
				hh += '</td>';
				{/if}
				{if getcustom('guige_limit_start')}
				hh += '<td>';
				hh += ' <input name="option['+ks+'][limit_start]" type="number" min="0" style="width:60px" value="'+(val.limit_start<=0?'0':val.limit_start)+'" class="layui-input"/>';
				if(i==0){
					hh += ' <i class="fa fa-hand-o-down" style="cursor:pointer" title="批量设置" onclick="plset(\'limit_start\')"></i>';
				}
				hh += '</td>';
				{/if}
				hh += '<td id="ggpic'+ks2+'"><input type="hidden" name="option['+ks+'][pic]" id="ggpicval'+ks2+'" value="'+(val.pic==null?'':val.pic)+'"/><img class="thumb_img" src="'+(val.pic==null?'':val.pic)+'" style="max-width:50px;"/> <button class="layui-btn layui-btn-sm layui-btn-primary" onclick="uploader(this)" upload-input="ggpicval'+ks2+'" upload-preview="ggpic'+ks2+'" type="button">上传</button></td>';
				hh += "</tr>";
			}
			html+=hh;
			$("#ggvaldiv").html(html);
		}
		function plset(name){
			if(name =='procode'){
				var procode = $("input[name$='["+name+"]']").eq(0).val();
				if(procode == '') procode = randomString(6);
				$("input[name$='["+name+"]']").each(function(i,v){
					if(i>0) $(this).val(procode+ '-'+i);
				})
			}else{
				$("input[name$='["+name+"]']").val($("input[name$='["+name+"]']").eq(0).val());
			}
		}
		function plsetlevelprice(i,k){
			var thisprice = $('#levelprice_'+i+'_'+k).val();
			console.log(thisprice)
			var level0price = $('#levelprice_0_0').val();
			console.log(level0price)
			var pricepercent = thisprice / level0price;
			console.log(pricepercent)
			$("input[name$='][market_price]']").each(function(i2,v2){
				var this_price = $('#levelprice_'+i2+'_0').val() * pricepercent;
				console.log(this_price)
				this_price = parseInt(this_price*100)/100;
				$('#levelprice_'+i2+'_'+k).val(this_price);
			})
		}
		function randomString(len) {
	　　len = len || 32;
	　　var $chars = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678';    /****默认去掉了容易混淆的字符oOLl,9gq,Vv,Uu,I1****/
	　　var maxPos = $chars.length;
	　　var pwd = '';
	　　for (i = 0; i < len; i++) {
	　　　　pwd += $chars.charAt(Math.floor(Math.random() * maxPos));
	　　}
	　　return pwd;
		}
	
		layui.form.on('checkbox(gettjset)', function(data){
			console.log(data)
			if(data.elem.checked){
				$('#gettjset').hide();
			}else{
				$('#gettjset').show();
			}
		});
		var chooseUrlField = '';
		function chooseUrl2(field){
			chooseUrlField = field;
			layer.open({type:2,shadeClose:true,area:['1100px', '650px'],'title':'选择链接',content:"{:url('DesignerPage/chooseurl')}&callback=chooseLink2"})
		}
		function chooseLink2(urlname,url){
			$("#"+chooseUrlField).val(url);
		}

		function showChooseCategory(){
			layer.open({type:2,title:'选择类目',content:"{:url('Wxvideo/allcategory')}&ischoose=1",area:['900px','600px'],shadeClose:true});
		}
		function chooseCategory(data){
			console.log(data)
			$("input[name='info[wxvideo_third_cat_id]']").val(data.third_cat_id);
		}

		/**
		 * 1.监听select的选中与取消
		 *
		 * formSelects.on(ID, Function);
		 *
		 * @param ID        xm-select的值
		 * @param Function  自定义处理方法
		 * @param isEnd     是否获取实时数据, true/false
		 */
		var formSelects = layui.formSelects;
		var paramdata='{$info[\'paramdata\']}';
		// console.log('paramdata')
		// console.log(paramdata)
		formSelects.on('selectCid', function(id, vals, val, isAdd, isDisabled){
			//console.log($("input[name='info[cid]']").val())
			var cid = $("input[name='info[cid]']").val();
			$.post("{:url('getParam')}",{cid:cid},function(data){
				if(data.status == 1){
					var paramlist = data.paramlist;
					var html = '';
					for(var i=0;i<paramlist.length;i++){
						html += '<div class="layui-form-item">';
						html += '	<label class="layui-form-label">';
						if(paramlist[i]['is_required']==1) html += '<span class="redstar">*</span>';
						html += paramlist[i]['name'];html += '：</label>';
						if(paramlist[i]['type']=='0'){
							html += '<div class="layui-input-inline" style="width:240px">';
							html += '<input type="text" class="layui-input" name="paramdata['+paramlist[i]['name']+']" ';
							if(typeof (paramdata[paramlist[i]['name']]) != 'undefined')
								html +=' value="'+ paramdata[paramlist[i]['name']]+'"';
							if(paramlist[i]['is_required']==1) html += ' lay-verify="required" lay-verType="tips"';
							html += ' placeholder="'+paramlist[i]['tips']+'"/>';
							html += '</div>';
						}else if(paramlist[i]['type']=='1'){
							html += '<div class="layui-input-inline" style="width:240px">';
							html += '	<select name="paramdata['+paramlist[i]['name']+']"';
							if(paramlist[i]['is_required']==1) html += ' lay-verify="required" lay-verType="tips"';
							html += '	>';
							html += '<option value="">'+paramlist[i]['tips']+'</option>';
							//console.log(paramlist[i]['params'])
							var parsms = JSON.parse(paramlist[i]['params']);
							for(var j=0;j<parsms.length;j++){
								if (paramdata[paramlist[i]['name']] == parsms[j]){
									html += '<option selected>'+parsms[j]+'</option>';
								}else{
									html += '<option>'+parsms[j]+'</option>';
								}
							}
							html += '</select></div>';
						}else if(paramlist[i]['type']=='2'){
							html += '<div class="layui-input-inline" style="width:240px">';
							var parsms = JSON.parse(paramlist[i]['params']);
							for(var j=0;j<parsms.length;j++){
								html += '<input type="checkbox" name="paramdata['+paramlist[i]['name']+'][]" value="'+parsms[j]+'" title="'+parsms[j]+'" lay-skin="primary" ';
								if(Array.isArray(paramdata[paramlist[i]['name']]) && paramdata[paramlist[i]['name']].indexOf(parsms[j]) != -1) html += ' checked';
								html += ' />';
							}
							html += '</div>';
							html += '<div class="layui-form-mid layui-word-aux" style="clear:left;margin-left:130px">{$param.tips}</div>';
						}

						html += '</div>';

					}
					if(paramlist.length == 0){
						html = '<div class="layui-form-item"><label class="layui-form-label"></label><div class="layui-form-mid">暂未添加商品参数或当前商品分类下无参数，<a href="javascript:void(0)" onclick="openmax(\'{:url(\'ShopParam/index\')}&isopen=1\')">去添加</a></div></div>';
					}
// console.log(html);
					$(".paramTab").html(html);

					layui.form.render();
				}
			})
			//id:           点击select的id
			//vals:         当前select已选中的值
			//val:          当前select点击的值
			//isAdd:        当前操作选中or取消
			//isDisabled:   当前选项是否是disabled

			//如果return false, 那么将取消本次操作
			// return false;
		},true);
		</script>

	<script>
	layui.form.on('radio(show_recommend)',function(data){
		if(data.value == 2){
			$('.show_recommend2').show();
		}else{
			$('.show_recommend2').hide();
		}
	})
	layui.form.on('submit(formsubmit)', function(obj){
		var field = obj.field
		field.specs = JSON.stringify(specs)
		//field['info[detail]'] = ueditor.getContent();
		field['info[detail]'] = geteditordata();
		//console.log(field);return;
		if(field['info[freighttype]'] == 0 && field['info[freightdata]'] == ''){
			dialog('请选择运费模板');
			return;
		}
		var index = layer.load();
		$.post("{:url('save')}",field,function(data){

			dialog(data.msg,data.status);
			if(data.status == 1){
				setTimeout(function(){
					parent.layer.closeAll();
					parent.tableIns.reload()
				},1000)
			}
		})
	})
  </script>
	{include file="public/copyright"/}
</body>
</html>